/**
 * @author yan
 * @date 2025/8/9
 */
public class ti3 {
    class Solution {
        public int lengthOfLongestSubstring(String s) {
            int l=0,max=0;
            int [] index = new int[128];
            for(int i=0;i<s.length();i++){
                char c = s.charAt(i);
                l = Math.max(l,index[c]);
                max = Math.max(max,i-l+1);
                index[c] = i+1;
            }
            return max;
        }
    }
    public static void main(String[] args) {

    }
}
